View Javadoc

1   // Browser.java, created Sat May 25 12:46:16 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Linker.ELF;
5   
6   import java.util.Iterator;
7   import java.util.List;
8   import java.io.IOException;
9   import java.io.RandomAccessFile;
10  
11  /***
12   * Browser
13   * 
14   * @author John Whaley
15   * @version $Id: Browser.java 1985 2004-10-08 08:43:02Z joewhaley $
16   */
17  public class Browser {
18  
19      public static void main(String[] args) throws IOException {
20          RandomAccessFile f = new RandomAccessFile(args[0], "r");
21          browseFile(f);
22      }
23      
24      public static void browseFile(RandomAccessFile file) throws IOException {
25          ELFRandomAccessFile f = new ELFRandomAccessFile(file);
26          List sections = f.getSections();
27          for (Iterator i=sections.iterator(); i.hasNext(); ) {
28              Section s = (Section) i.next();
29              System.out.println(s);
30          }
31      }
32      
33  }